package com.h3bpm.web.protalHanding;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Task implements InitializingBean {
	private static final Logger logger = LoggerFactory.getLogger(Task.class);

	@Value("${task.bpm}")
	public String taskBpm;
	@Override
	public void afterPropertiesSet() throws Exception {
		new Thread(new Runnable() {
			@Override
			public void run() {

				while(true){
					try {

						if("0".equals(taskBpm)){
							Thread.sleep(6123);
						}else{
							Thread.sleep(4678);
						}
						//	 生产服务器BPM1定时任务:
						//	 Thread.sleep(4678);
						//	 生产服务器BPM2定时任务:
//						Thread.sleep(6123);
						logger.debug("线程执行开始——————————————"+taskBpm);
						//具体实现代码
						Threading.updateException();
						logger.debug("线程执行结束——————————————");
					} catch (InterruptedException e) {
						e.printStackTrace();
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
			}
		}).start();
	}

}
